/*
 * WorkspaceClases.h
 *
 *  Created on: 28/04/2013
 *      Author: juan
 */

#ifndef WORKSPACECLASES_H_
#define WORKSPACECLASES_H_

#include "Workspace.h"
#include "gui/VisualComponents/VisualClassesComponent.h"
#include "gui/VisualComponents/clases/VisualClassComponentVia.h"

class WorkspaceClases: public Workspace {
public:
    WorkspaceClases(Diagram* diagram, bool enableEvents = true);
    virtual ~WorkspaceClases();

    VisualClassesComponent* getClassesVisualComponent(Component* c) {
    	return dynamic_cast<VisualClassesComponent *>(getVisualComponent(c));
    }

    void validateDiagram(std::string archivo);
    void on_load(XmlReader& reader, Tabs* tabs);
    void on_load(XmlReader& readerModel, XmlReader & readerRep, Tabs* tabs);
    void store(XmlWriter& writer_rep, XmlWriter& writer_comp);
    void store(XmlWriter& writer_rep, XmlWriter& writer_comp, std::string tabName);

private:
    VisualDiagramComponent* buildComposedComponent(const char* nameComponente,Diagram* m_diagram,
    		XmlReader& reader, std::map< unsigned, unsigned > & startFromVias);
    void connectComponents(std::map< unsigned, VisualDiagramComponent* > & visualComponents,
    		std::map< unsigned, std::vector<int> > & idsComponentesEntradas,
    		std::map<unsigned, unsigned> & startFromVias);
};

#endif /* WORKSPACECLASES_H_ */
